const http=require('http');
const server=http.createServer((req,res)=>{
    const {method}=req
    const {pathname}=new URL(req.url,'http://127.0.0.1');
   res.setHeader('Content-Type','text/plain;charset=utf-8')
   if(method==='GET'&&pathname==='/login'){
    res.end('登陆页面')
   }else if(method==='GET'&&pathname==='/reg'){
    res.end('注册页面')
   }else{
    res.end('404')
   }    
})
server.listen(9000,'127.0.0.1',()=>{
    console.log('listening...');
})